home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_09 / xmpl_05.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  732 b   |  43 lines  |  [TEXT/R*ch]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 9, example 5
  5.  
  6. -- set up XYZ as in the previous example
  7. module XYZ
  8.     uses ScriptX
  9.     exports x, y, z
  10. end
  11. in module XYZ
  12. global x := 10
  13. global y := "foo"
  14. global z := #(56,567)
  15.  
  16. -- This module uses XYZ, imports only x, and renames it to be
  17. -- externalX
  18. module XYZrename1
  19.     uses ScriptX
  20.     uses XYZ with 
  21.         renames x:externalX
  22.     end
  23. end
  24. in module XYZrename1
  25. print externalX
  26. print y
  27.  
  28. -- now explicitly import x and y, but rename x. rename
  29. -- overrides import
  30. module XYZrename2
  31.     uses ScriptX
  32.     uses XYZ with
  33.         imports x, y
  34.         renames x:otherX
  35.     end
  36. end
  37. in module XYZrename2
  38. -- this should generate an exception
  39. print x
  40. -- no problem here though
  41. print otherX
  42. print y
  43. -->>>